//
//  Tower.h
//  FrameWork
//
//  Created by Eagle on 5/31/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "cocos2d.h"
#import "Enemy.h"
//#import "GameScene.h"

enum TowerStage 
{
	TOWERSTATE_SEARCH = 0,
	TOWERSTATE_TURN,
	TOWERSTATE_ATTACK
};


enum TowerInfo 
{
	kLevelLabel = 0
};

@interface Tower : CCSprite {
	//金钱参数
	int _money;
	int _sellMoney;
	int _levelMoney;
	
	//类型
	int _type;
	
	//等级
	int _level;
	
	//攻击间隔
	int _interval;
	
	//攻击刷新参数
	int _frame;
	
	//攻击范围
	float _range;
	
	//锁定的目标
	Enemy* _target;
	
	//当前的角度
	float _myDegree;
	
	//当前的区域,用于显示
	int _myArea;
	
	//上次的区域
	int _myLastArea;
	
	//攻击夹角,单侧
	float _attackDegree;
	
	//转动速度,每桢
	float _turnSpeed;
	
	//箭塔状态
	int _towerState;
	
	//攻击状态持续时间
	int _attackAniLastTime;
	
	//攻击状态计时
	int _attackAniFrame;
	
	//旋转顺时针,还是逆时针 ,1 顺时针, 2 逆时针
	int _clockOrWise;
	
	//用于切换在图片中的矩形
	CGRect _myRect[9];
	
	
}

@property(nonatomic, assign) int money;
@property(nonatomic, assign) int sellMoney;
@property(nonatomic, assign) int levelMoney;

@property(nonatomic, assign) int type;
@property(nonatomic, assign) int level;
@property(nonatomic, assign) int interval;
@property(nonatomic, assign) int frame;
@property(nonatomic, assign) float range;
@property(nonatomic, retain) Enemy* target;


@property(nonatomic, assign) float myDegree;
@property(nonatomic, assign) int myArea;
@property(nonatomic, assign) int myLastArea;


@property(nonatomic, assign) float attackDegree;
@property(nonatomic, assign) float turnSpeed;

@property(nonatomic, assign) int towerState;
@property(nonatomic, assign) int attackAniLastTime;
@property(nonatomic, assign) int attackAniFrame;

@property(nonatomic, assign) int clockOrWise;

+(id) tower:(int)type level:(int)level;

-(void)InitRect;

-(void)SetRectFromArea:(int)area; 

-(void)levelUp;

-(void)changeToAttack;

-(void)changeToNormal;

@end
